package com.cj.config;

import com.cj.Book;
import com.cj.User;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @author cc
 * @date 2025-05-12 08:18
 **/

public class DemoJavaConfig {

    public static void main(String[] args) {
        AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(JavaConfig.class);
        User user = ctx.getBean("user", User.class);
        System.out.println("user = " + user);


        Book book = ctx.getBean("book", Book.class);

        System.out.println(user.getBook()==book);
    }
}
